#encoding:utf-8
# Create your views here.
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
from django.template import RequestContext

def vacancies_list(request):
    if request.method == 'POST':
        username = request.POST['username']
        password = request.POST['password']
        user = authenticate(username=username, password=password)
        if user is not None:
            if user.is_active:
                login(request, user)
                # Redirect to a success page.
                return render_to_response('vacancies.html', {'is_ok': 'isok'}, context_instance = RequestContext(request))
            else:
                # Return a 'disabled account' error message
                return render_to_response('vacancies.html', context_instance = RequestContext(request))
        #else:
            # Return an 'invalid login' error message.
    return render_to_response('vacancies.html', context_instance = RequestContext(request))